package com.itmumu.miniwechat.user.domain.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 用户表
 * @TableName user
 */
@TableName(value ="user")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class User implements Serializable {
    /**
     * 用户ID
     */
    @TableId(type = IdType.AUTO)
    private Integer uid;

    /**
     * 用户昵称
     */
    private String nickname;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 性别：0=未知，1=男，2=女
     */
    private Integer gender;

    /**
     * 手机号
     */
    private String mobile;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 用户类型：1=wechat，2=wxapp，3=offiaccount
     */
    private Integer userType;

    /**
     * 密码
     */
    private String password;

    /**
     * 个性签名
     */
    private String personalSignature;

    /**
     * 登录账号
     */
    private String loginNumber;

    /**
     * 微信返回的openid
     */
    private String openid;

    /**
     * 账号状态: 1=禁用，0=正常
     */
    private Integer status;

    /**
     * 国家
     */
    private String country;

    /**
     * 城市
     */
    private String city;

    /**
     * 地区
     */
    private String province;

    /**
     * 是否关注
     */
    private Integer isFollow;

    /**
     * 关注时间
     */
    private Long followtime;

    /**
     * 取消关注时间
     */
    private Long unfollowtime;

    /**
     * 最近登录时间
     */
    private Long lastLoginTime;

    /**
     * 最后下线时间
     */
    private Long lastOffTime;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private Long createTime;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
            && (this.getNickname() == null ? other.getNickname() == null : this.getNickname().equals(other.getNickname()))
            && (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
            && (this.getGender() == null ? other.getGender() == null : this.getGender().equals(other.getGender()))
            && (this.getMobile() == null ? other.getMobile() == null : this.getMobile().equals(other.getMobile()))
            && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail()))
            && (this.getUserType() == null ? other.getUserType() == null : this.getUserType().equals(other.getUserType()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getPersonalSignature() == null ? other.getPersonalSignature() == null : this.getPersonalSignature().equals(other.getPersonalSignature()))
            && (this.getLoginNumber() == null ? other.getLoginNumber() == null : this.getLoginNumber().equals(other.getLoginNumber()))
            && (this.getOpenid() == null ? other.getOpenid() == null : this.getOpenid().equals(other.getOpenid()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCountry() == null ? other.getCountry() == null : this.getCountry().equals(other.getCountry()))
            && (this.getCity() == null ? other.getCity() == null : this.getCity().equals(other.getCity()))
            && (this.getProvince() == null ? other.getProvince() == null : this.getProvince().equals(other.getProvince()))
            && (this.getIsFollow() == null ? other.getIsFollow() == null : this.getIsFollow().equals(other.getIsFollow()))
            && (this.getFollowtime() == null ? other.getFollowtime() == null : this.getFollowtime().equals(other.getFollowtime()))
            && (this.getUnfollowtime() == null ? other.getUnfollowtime() == null : this.getUnfollowtime().equals(other.getUnfollowtime()))
            && (this.getLastLoginTime() == null ? other.getLastLoginTime() == null : this.getLastLoginTime().equals(other.getLastLoginTime()))
            && (this.getLastOffTime() == null ? other.getLastOffTime() == null : this.getLastOffTime().equals(other.getLastOffTime()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
        result = prime * result + ((getNickname() == null) ? 0 : getNickname().hashCode());
        result = prime * result + ((getAvatar() == null) ? 0 : getAvatar().hashCode());
        result = prime * result + ((getGender() == null) ? 0 : getGender().hashCode());
        result = prime * result + ((getMobile() == null) ? 0 : getMobile().hashCode());
        result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode());
        result = prime * result + ((getUserType() == null) ? 0 : getUserType().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getPersonalSignature() == null) ? 0 : getPersonalSignature().hashCode());
        result = prime * result + ((getLoginNumber() == null) ? 0 : getLoginNumber().hashCode());
        result = prime * result + ((getOpenid() == null) ? 0 : getOpenid().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCountry() == null) ? 0 : getCountry().hashCode());
        result = prime * result + ((getCity() == null) ? 0 : getCity().hashCode());
        result = prime * result + ((getProvince() == null) ? 0 : getProvince().hashCode());
        result = prime * result + ((getIsFollow() == null) ? 0 : getIsFollow().hashCode());
        result = prime * result + ((getFollowtime() == null) ? 0 : getFollowtime().hashCode());
        result = prime * result + ((getUnfollowtime() == null) ? 0 : getUnfollowtime().hashCode());
        result = prime * result + ((getLastLoginTime() == null) ? 0 : getLastLoginTime().hashCode());
        result = prime * result + ((getLastOffTime() == null) ? 0 : getLastOffTime().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", uid=").append(uid);
        sb.append(", nickname=").append(nickname);
        sb.append(", avatar=").append(avatar);
        sb.append(", gender=").append(gender);
        sb.append(", mobile=").append(mobile);
        sb.append(", email=").append(email);
        sb.append(", userType=").append(userType);
        sb.append(", password=").append(password);
        sb.append(", personalSignature=").append(personalSignature);
        sb.append(", loginNumber=").append(loginNumber);
        sb.append(", openid=").append(openid);
        sb.append(", status=").append(status);
        sb.append(", country=").append(country);
        sb.append(", city=").append(city);
        sb.append(", province=").append(province);
        sb.append(", isFollow=").append(isFollow);
        sb.append(", followtime=").append(followtime);
        sb.append(", unfollowtime=").append(unfollowtime);
        sb.append(", lastLoginTime=").append(lastLoginTime);
        sb.append(", lastOffTime=").append(lastOffTime);
        sb.append(", createTime=").append(createTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}